
package com.ruoyi.web.controller.wx;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.service.WxMasUserService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 微信小程序用户接口
 *
 * @author <a href="https://github.com/binarywang">Binary Wang</a>
 */

@RestController
@AllArgsConstructor
@Slf4j
@RequestMapping("")
public class WxMaUserController {
    private final WxMasUserService wxMasUserService;


/**
     * 登陆接口
     */

    @GetMapping("/login")
    public R<Void> login(@PathVariable String appid, String code) {
        return R.ok(wxMasUserService.login(appid,code));
    }


/**
     * <pre>
     * 获取用户信息接口
     * </pre>
     */

    @GetMapping("/info")
    public R<Void> info(@PathVariable String appid, String sessionKey,
                       String signature, String rawData, String encryptedData, String iv) {
        return R.ok(wxMasUserService.info(appid,sessionKey,signature,rawData,encryptedData,iv));

    }

/**
     * <pre>
     * 获取用户绑定手机号信息
     * </pre>
     */

    @GetMapping("/phone")
    public R<Void> phone(@PathVariable String appid, String sessionKey, String signature,
                        String rawData, String encryptedData, String iv) {
        return R.ok(wxMasUserService.phone(appid,sessionKey,signature,rawData,encryptedData,iv));
    }

}

